.class public Lcom/brixd/niceapp/model/TagModel;
.super Lcom/niceapp/lib/tagview/Tag;
.source "TagModel.java"


# static fields
.field private static final serialVersionUID:J = -0x5a3369a23380db94L


# instance fields
.field private type:Ljava/lang/String;


# direct methods
.method public constructor <init>(ILjava/lang/String;)V
    .registers 3
    .param p1, "id"    # I
    .param p2, "title"    # Ljava/lang/String;

    .prologue
    .line 18
    invoke-direct {p0, p1, p2}, Lcom/niceapp/lib/tagview/Tag;-><init>(ILjava/lang/String;)V

    .line 20
    return-void
.end method

.method public constructor <init>(ILjava/lang/String;Ljava/lang/String;)V
    .registers 4
    .param p1, "id"    # I
    .param p2, "title"    # Ljava/lang/String;
    .param p3, "type"    # Ljava/lang/String;

    .prologue
    .line 23
    invoke-direct {p0, p1, p2}, Lcom/niceapp/lib/tagview/Tag;-><init>(ILjava/lang/String;)V

    .line 24
    iput-object p3, p0, Lcom/brixd/niceapp/model/TagModel;->type:Ljava/lang/String;

    .line 25
    return-void
.end method

.method public static convertTagsToJSONString(Ljava/util/List;)Ljava/lang/String;
    .registers 8
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/TagModel;",
            ">;)",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .line 53
    .local p0, "tags":Ljava/util/List;, "Ljava/util/List<Lcom/brixd/niceapp/model/TagModel;>;"
    new-instance v2, Lorg/json/JSONArray;

    invoke-direct {v2}, Lorg/json/JSONArray;-><init>()V

    .line 54
    .local v2, "jsonArray":Lorg/json/JSONArray;
    const/4 v1, 0x0

    .local v1, "i":I
    :goto_6
    invoke-interface {p0}, Ljava/util/List;->size()I

    move-result v5

    if-ge v1, v5, :cond_3d

    .line 55
    invoke-interface {p0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/brixd/niceapp/model/TagModel;

    .line 57
    .local v4, "tag":Lcom/brixd/niceapp/model/TagModel;
    :try_start_12
    new-instance v3, Lorg/json/JSONObject;

    invoke-direct {v3}, Lorg/json/JSONObject;-><init>()V

    .line 58
    .local v3, "jsonObject":Lorg/json/JSONObject;
    const-string v5, "id"

    invoke-virtual {v4}, Lcom/brixd/niceapp/model/TagModel;->getId()I

    move-result v6

    invoke-virtual {v3, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    .line 59
    const-string v5, "title"

    invoke-virtual {v4}, Lcom/brixd/niceapp/model/TagModel;->getTitle()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v3, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 60
    const-string v5, "type"

    invoke-virtual {v4}, Lcom/brixd/niceapp/model/TagModel;->getType()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v3, v5, v6}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 62
    invoke-virtual {v2, v3}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;
    :try_end_35
    .catch Lorg/json/JSONException; {:try_start_12 .. :try_end_35} :catch_38

    .line 54
    .end local v3    # "jsonObject":Lorg/json/JSONObject;
    :goto_35
    add-int/lit8 v1, v1, 0x1

    goto :goto_6

    .line 63
    :catch_38
    move-exception v0

    .line 64
    .local v0, "e":Lorg/json/JSONException;
    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_35

    .line 69
    .end local v0    # "e":Lorg/json/JSONException;
    .end local v4    # "tag":Lcom/brixd/niceapp/model/TagModel;
    :cond_3d
    invoke-virtual {v2}, Lorg/json/JSONArray;->toString()Ljava/lang/String;

    move-result-object v5

    return-object v5
.end method

.method private static parseTagModel(Lorg/json/JSONObject;)Lcom/brixd/niceapp/model/TagModel;
    .registers 5
    .param p0, "jsonObject"    # Lorg/json/JSONObject;

    .prologue
    .line 49
    new-instance v0, Lcom/brixd/niceapp/model/TagModel;

    const-string v1, "id"

    invoke-virtual {p0, v1}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    move-result v1

    const-string v2, "title"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "type"

    invoke-virtual {p0, v3}, Lorg/json/JSONObject;->optString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v0, v1, v2, v3}, Lcom/brixd/niceapp/model/TagModel;-><init>(ILjava/lang/String;Ljava/lang/String;)V

    return-object v0
.end method

.method public static parseTagModels(Lorg/json/JSONArray;)Ljava/util/List;
    .registers 4
    .param p0, "array"    # Lorg/json/JSONArray;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lorg/json/JSONArray;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/brixd/niceapp/model/TagModel;",
            ">;"
        }
    .end annotation

    .prologue
    .line 36
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 37
    .local v1, "tags":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Lcom/brixd/niceapp/model/TagModel;>;"
    if-nez p0, :cond_8

    .line 45
    :cond_7
    return-object v1

    .line 41
    :cond_8
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_9
    invoke-virtual {p0}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-ge v0, v2, :cond_7

    .line 42
    invoke-virtual {p0, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v2

    invoke-static {v2}, Lcom/brixd/niceapp/model/TagModel;->parseTagModel(Lorg/json/JSONObject;)Lcom/brixd/niceapp/model/TagModel;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 41
    add-int/lit8 v0, v0, 0x1

    goto :goto_9
.end method


# virtual methods
.method public getType()Ljava/lang/String;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/brixd/niceapp/model/TagModel;->type:Ljava/lang/String;

    return-object v0
.end method

.method public setType(Ljava/lang/String;)V
    .registers 2
    .param p1, "type"    # Ljava/lang/String;

    .prologue
    .line 32
    iput-object p1, p0, Lcom/brixd/niceapp/model/TagModel;->type:Ljava/lang/String;

    .line 33
    return-void
.end method
